package com.aids_malaria.db.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import com.aids_malaria.http.response.DiagnosisInfoPack;

import java.util.List;


@Dao
public interface DiagnosisInfoPackDao {
    @Query("delete from diagnosisInfoPack")
    int deleteAll();

    @Delete
    int delete(DiagnosisInfoPack diagnosisInfoPack);

    @Query("SELECT * FROM diagnosisInfoPack")
    List<DiagnosisInfoPack> getAll();

    @Query("SELECT * FROM diagnosisInfoPack WHERE createOrUpdate =:isCreateUpdate")
    List<DiagnosisInfoPack> getAllByCreateUpdate(boolean isCreateUpdate);

    @Query("SELECT * FROM diagnosisInfoPack")
    List<DiagnosisInfoPack> getAllCreateU();

    @Query("SELECT * FROM diagnosisInfoPack WHERE identity_code IN (:identity_code)")
    List<DiagnosisInfoPack> findById(String identity_code);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Long insert(DiagnosisInfoPack user);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    List<Long> insertAll(List<DiagnosisInfoPack> users);

    @Update()
    int update(DiagnosisInfoPack user);
}

